import moment from 'moment';
import { message } from 'antd';

export default (time: string) => {
  const _time = moment(time, 'YYYY-MM-DD HH:mm:ss');
  if (!_time.isValid()) {
    message.error('无效的时间数据！');
    return;
  }
  return moment()
    .set('hour', _time.get('hour'))
    .set('minute', _time.get('minute'))
    .set('second', _time.get('second'))
    .format('HH:mm:ss');
};